package com.axxc.jpa.task.rabbitmsg.receiver;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * 
 * @ClassName RabbitMqTopicExchangeMsgReceiver
 * @Description 消费路由key为topic.message队列中的消息
 * @author xxc
 * @data 2018年8月4日上午12:10:35
 */
@Component
@RabbitListener(queues = "topic.message")
public class RabbitMqTopicExchangeMsgReceiverA {

	private Logger logger = LoggerFactory.getLogger(getClass());

	@RabbitHandler
	public void processA(String msg) {
		/**
		 * sender2发送的消息，routing_key是“topic.messages”，
		 * 所以exchange里面的绑定的binding_key只有topic.＃都符合路由规则;所以sender2发送的消息只有队列
		 * topic.messages能收到。
		 */
		logger.info("topicMessageReceiver  -消费者 : {}", msg);
	}
}
